use Test::More 'no_plan';

use lib "../lib/cpp", "../lib/ioc", "../lib/toolkit", "../lib/message";
use TinyMessage;
use CHeaderParser;

my $checks = {
	0 => sub { my($class, @namespace) = @_; is($class, 'Z'); is_deeply(\@namespace, []); },
	1 => sub { my($class, @namespace) = @_; is($class, 'first::A'); is_deeply(\@namespace, ['first']); },
	2 => sub { my($class, @namespace) = @_; is($class, 'X'); is_deeply(\@namespace, []); },
	3 => sub { my($class, @namespace) = @_; is($class, 'second::B'); is_deeply(\@namespace, ['second']); },
	4 => sub { my($class, @namespace) = @_; is($class, 'second::second_in::C'); is_deeply(\@namespace, ['second', 'second_in']); },
	5 => sub { my($class, @namespace) = @_; is($class, 'second::D'); is_deeply(\@namespace, ['second']); },
	6 => sub { my($class, @namespace) = @_; is($class, 'C'); is_deeply(\@namespace, []); },
	7 => sub { my($class, @namespace) = @_; is($class, 'a::b::E'); is_deeply(\@namespace, ['a', 'b']); },
	8 => sub { my($class, @namespace) = @_; is($class, 'V'); is_deeply(\@namespace, []); }
}; 

my $counter = 0;

CHeaderParser::parse(\*DATA, {
	class => sub { 
		my $context = shift;
		my $class = $context->classContext();
		my @namespace = $context->fullNamespace();
		
		&{ $checks->{$counter} } ($class->name(), @namespace);
		
		$counter++;
	}
});


ok(1==1);

__DATA__
/*
 * ConsoleLogModule.h
 *
 *  Created on: 21.11.2011
 *      Author: caiiiycuk
 */

#ifndef CONSOLELOGMODULE_H_
#define CONSOLELOGMODULE_H_

class Z{}

namespace first {
	class A {}
}

class X {}

namespace second {
	class B {}

	namespace second_in {
		class C{}
	}
	
	class D {}
}

class C {}

namespace a { 
namespace b{
	class E {}
} 
}

class V {}

#endif /* CONSOLELOGMODULE_H_ */